package com.xbongbong.paas.domain.dao;

import com.xbongbong.paas.domain.entity.PaasFormSubDataEntity;
import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * paas表单子表单数据(TbPaasFormPaasSubData)表数据库访问层
 *
 * @author makejava
 * @since 2020-09-04 09:41:30
 */
@Repository
@Mapper
public interface PaasFormPaasSubDataDao {
    /**
     * 新增数据
     *
     * @param paasFormSubDataEntity 实例对象
     * @return 影响行数
     */
    Integer insert(@Param("entity") PaasFormSubDataEntity paasFormSubDataEntity, @Param("tableName") String tableName);

    /**
     * 修改数据
     *
     * @param paasFormSubDataEntity 实例对象
     * @return 影响行数
     */
    Integer update(@Param("entity") PaasFormSubDataEntity paasFormSubDataEntity, @Param("tableName") String tableName);

    /**
     * @param paasFormSubDataEntityList
     */
    Integer insertBatch(@Param("list") List<? extends PaasFormSubDataEntity> paasFormSubDataEntityList, @Param("tableName") String tableName);

    /**
     * @param param
     * @return
     */
    List<? extends PaasFormSubDataEntity> findEntitys(@Param("param") Map<String, Object> param, @Param("tableName") String tableName);

    /**
     * @param param
     * @return
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param, @Param("tableName") String tableName);

    Integer deleteByDataId(@Param("dataId") Long dataId, @Param("corpid") String corpid, @Param("tableName") String tableName);

    List<? extends PaasFormSubDataEntity> getByDataId(@Param("dataId") Long dataId, @Param("corpid") String corpid, @Param("tableName") String tableName);

    List<? extends PaasFormSubDataEntity> getByDataIds(@Param("dataIds") Collection<Long> dataIds, @Param("corpid") String corpid, @Param("del") Integer del, @Param("tableName") String tableName);

    Integer deleteBatchByDataId(@Param("list") List<Long> list, @Param("corpid") String corpid, @Param("tableName") String tableName, @Param("del") Integer del);

    Integer deleteById(@Param("ids") List<Long> ids, @Param("corpid") String corpid, @Param("tableName") String tableName);

    Integer updateBatch(@Param("list") List<UpdateDataEntity> entities, @Param("corpid") String corpid, @Param("tableName") String tableName);

    /**
     * 更新del
     * @param ids
     * @param corpid
     * @param tableName
     * @param del
     * @return
     */
    Integer updateDelByIdList(@Param("list") List<Long> ids, @Param("corpid") String corpid, @Param("tableName") String tableName, @Param("del") Integer del);
    /**
     * 更新下更新时间
     * @param entities
     * @param corpid
     * @param tableName
     * @return
     */
    Integer updateBatchTime(@Param("list") List<UpdateDataEntity> entities, @Param("corpid") String corpid, @Param("tableName") String tableName);

    Integer restoreBatch(@Param("list") List<Long> dataIds, @Param("corpid") String corpid, @Param("tableName") String tableName);

    /**
     * 根据实体去更新数据
     * @param updateList
     * @param corpid
     * @param tbSaasPaymentSubData
     * @return
     */
    Integer updateBatchByEntity(@Param("list") List<? extends PaasFormSubDataEntity> updateList, @Param("corpid")String corpid, @Param("tableName") String tbSaasPaymentSubData);

    /**
     * 获取老回款计划(现应收款)中的最大id
     *
     * @param param
     * @param tableName
     * @return
     */
    Long getMaxId(@Param("param")Map<String, Object> param, @Param("tableName") String tableName);

    PaasFormSubDataEntity getByKey(@Param("id") Long id, @Param("corpid") String corpid, @Param("tableName") String tableName);

    void insertBatchCK(@Param("list")List<? extends PaasFormSubDataEntity>  list, @Param("tableName") String tableName);
}
